<?php
/** 
 * EGP Framework
 *
 * LICENSE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author     Akon(番茄红了) <aultoale@gmail.com>
 * @copyright  Copyright (c) 2008 (http://www.tblog.com.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 */

!defined('EGP_LIB_DIR') && die('Access Deny!');

/**
 * 设定变量以便全局随时调用
 *
 * @package    classes
 * @author     Akon(番茄红了) <aultoale@gmail.com>
 * @copyright  Copyright (c) 2008 (http://www.tblog.com.cn)
 * @license    http://www.gnu.org/licenses/gpl.html     GPL 3
 */
abstract class EGP_Registry
{

    /**
     * 存储已设定数据
     *
     * @var array
     */
    protected static $_data = array();

    /**
     * 设置数据
     *
     * @param  string  $name
     * @param  mixed   $value
     */
    public static function set($name, $value)
    {
        self::$_data[$name] = $value;
    }

    /**
     * 获取已设定的数据
     *
     * @param  string  $name
     * @return mixed
     */
    public static function get($name)
    {
        return self::has($name) ? self::$_data[$name] : null;
    }

    /**
     * 查询是否已设定指定名称的数据
     *
     * @param  string  $name
     * @return boolean
     */
    public static function has($name)
    {
        return isset(self::$_data[$name]);
    }

}